<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ page import="org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter"%>
<%@ page import="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter"%>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>crm系统---系统登录</title>
		<script src="${ctx}/js/jquery.js" type="text/javascript"></script>
		<script>
	$(document).ready(function() {
		$(".ConfirmationCode").bind("click",function(){
			var imgSrc = $(this);
			var url = imgSrc.attr("src");

			var timestamp = (new Date()).valueOf();
			url = url.substring(0,32);
			if(url.indexOf("&") >= 0){
				url = url + "tamp=" + timestamp;
			}else{
				url = url + "?timestamp=" + timestamp;
			}
			imgSrc.attr("src",url);
		});
	});
	function init() {
		var o = document.getElementById("apDiv1");
		o.style.left = screen.width / 2 - 296 / 2 - 10 + "px";
	}
</script>
		<style type="text/css">
body {
	background-image: url(${ctx}/image/loginbg.gif);
	background-repeat: repeat-x;
	background-color: #dff0f8;
}
.error {
	color:#FF0000;
	font-size:12px;
	position: absolute;
	left: 556px;
	top: 220px;
	width: 396px;
	height: 192px;
	z-index: 1;
}
#apDiv1 {
	position: absolute;
	left: 496px;
	top: 240px;
	width: 296px;
	height: 192px;
	z-index: 1;
	background-image: url(${ctx}/image/login_mainBg.jpg);
	background-repeat: no-repeat;
}

#apDiv2 {
	position: absolute;
	left: 13px;
	top: 48px;
	width: 90px;
	height: 90px;
	z-index: 2;
}

#apDiv3 {
	position: absolute;
	left: 93px;
	top: -9px;
	width: 191px;
	height: 118px;
	z-index: 2;
	font-size: 12px;
}

.login_input_style {
	height: 18px;
	width: 103px;
	border: 1px solid #9bc8e9;
}

.login_checknum_style {
	height: 18px;
	width: 50px;
	border: 1px solid #9bc8e9;
}

.input_button_style {
	width: 50px;
	height: 20px;
	border: 1px solid #a3bfd4;
	background-image: url(${ctx}/image/login_button_bg.gif);
	background-repeat: no-repeat;
	font-size: 12px;
	color: #3f7eef;
}
</style>
	</head>
	<body>
		<body onload="init();">
				<%
					if (request.getParameter("errorCode") != null) {
				%> 
				<div class="error"> 验证码错误，请重试.</div> 
				<%
					}
				%>
				<%
					if (session.getAttribute(AbstractAuthenticationProcessingFilter.SPRING_SECURITY_LAST_EXCEPTION_KEY) != null) {
				%> 
				<div class="error"> 登录失败，请重试.</div> 
				<%
					}
				%>
			<div id="apDiv1">
				<div id="apDiv2">
					<img src="${ctx}/image/login_left.jpg" width="91" height="97" />
					<div id="apDiv3">
						<form action="${ctx}/j_spring_security_check" method="post" name="form1" id="form1">
							用户名：
							<input type='text' id='j_username' name='j_username' class="login_input_style"
					<s:if test="not empty param.error">
						value='<%=session.getAttribute(UsernamePasswordAuthenticationFilter.SPRING_SECURITY_LAST_USERNAME_KEY)%>'</s:if> />
							<br />
							密　码：
							<input type='password' id='j_password' name='j_password' class="login_input_style"/>
							<br />
							验证码：
							<input type="text" id='j_code' name="j_code" class="login_checknum_style" />
							<img src="${ctx}/img/ConfirmationCodeServlet" width="50" height="21" align="absmiddle" style="cursor: pointer;" class="ConfirmationCode"/>
							<p>
								　<input type="submit" name="button" id="button" value="提交" class="input_button_style" />　
								<input type="reset" name="button" id="button" value="重置" class="input_button_style" />
							</p>
						</form>
					</div>
				</div>
			</div>
		</body>
</html>

